<?php 
use yii\helpers\Url;
use yii\widgets\LinkPager;
?>


<?=$this->render('../_nav');?>

<div class="row borB">
    <div class="container">
        <ul id="myTab" class="nav nav-tabs mt10 smNav">
            <li <?php if(Yii::$app->request->get('action') == 'cashierlist'):?> class="active" <?php endif?>><a href="<?=Url::toRoute(['financial/cashier','action'=>'debtstatistics'])?>" >进账</a></li>
            <li <?php if(Yii::$app->request->get('action') == 'debtlist'):?> class="active" <?php endif?>><a href="<?=Url::toRoute(['financial/cashier','action'=>'refundlist'])?>" >退款</a></li>
        </ul>
    </div>
</div>
<div class="container mt20">
    <div class="table-responsive">
        <?php if(empty($list)){?>
        <table class="table table-bordered">
            <thead>
            <tr>
                <th>消费类型</th>
                <th>会员</th>
                <th>日期</th>
                <th>服务/产品名称</th>
                <th>总金额</th>
                <th>现金支付</th>
                <th>刷卡支付</th>
                <th>扣储值卡</th>
                <th>扣赠送金</th>
                <th>欠款</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td colspan="10" align="center"><img src="<?=Yii::getAlias('@web/backend/img/nodata.gif');?>"></td>
            </tr>
            </tbody>
        </table>
        <?php }else{?>
        <table class="table table-bordered userlist" >
            <thead>
            <tr>
                <th>消费类型</th>
                <th>会员</th>
                <th>日期</th>
                <th>服务/产品名称</th>
                <th>总金额</th>
                <th>现金支付</th>
                <th>刷卡支付</th>
                <th>扣储值卡</th>
                <th>扣赠送金</th>
                <th>欠款</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach ($list as $r):?>
            <tr>
                <td><?=$r['consume_type']?></td>
                <td><?=$r['member_name']['member_name']?></td>
                <td><?=$r['consume_time']?></td>
                <td><?=$r['consume_name']?></td>
                <td><?=$r['consume_amount']?></td>
                <td><?=$r['cash_pay']?></td>
                <td><?=$r['unionpay']?></td>
                <td><?=$r['balance_pay']?></td>
                <td><?=$r['give_pay']?></td>
                <td><?=$r['debt_count']?></td>
            </tr>
            <?php endforeach;?>
            </tbody>
        </table>
        <?php }?>
    </div>
    <div class="page" style="text-align:center;">
       <?=LinkPager::widget([
            'pagination' => $page,
            'firstPageLabel' => '首页',
            'nextPageLabel' => '下一页',
            'prevPageLabel' => '上一页',
            'lastPageLabel' => '末页',
            'hideOnSinglePage'=>false
        ]); ?>
    </div>


</div>
		




<?php $this->beginBlock('js_index_end') ?>
var posturl = '<?=Url::toRoute(['financial/cashier','action'=>'adduser']) ?>';
var csrf = '<?=Yii::$app->getRequest()->getCsrfToken()?>'
    $(function(){
        $('.table tr td').dblclick(function(){
            $(this).parent().find('input').removeAttr("readonly").removeClass('read-only');
            if(typeof($(this).find('input').attr('readonly')) =="undefined"){
                if($(this).find('a').length<1){
                    //$(this).append('<a class="ok edit" href="#">确定</a>');
                    $(this).parent().find('.fadeBox').show();
                    $(this).parent().find('.del').hide();
                }
            }

        $('.ok').click(function(){
            $(this).parent().find('input').attr('readonly',true).removeClass('read');
            $(this).parent().parent().find('.fadeBox').hide();
            $(this).parent().parent().find('.del').show();
            $(this).remove();
        })
        $('.rest').click(function(){
            $(this).parent().hide();
            $(this).parent().parent().find('.del').show();
            $(this).parent().parent().parent().find('input').attr('readonly',true).addClass('read-only');
            $(this).parent().parent().parent().find('.ok').remove();
        })
    })
    
    
})
<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['js_index_end'], $this::POS_END); ?>

<?php $this->registerJsFile("@web/system/financial/cashier/userlist.js",['position'=>$this::POS_END]);?>
